package com.mgface.framework.springcloud.feign;

import com.mgface.framework.springcloud.entity.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author wanyuxiang
 * @version 1.0
 * @project ms-feign
 * @create 2017-04-11 10:51
 **/
@FeignClient(name="ms-provider-user")
public interface UserFeignClient {
    /**
     * 通过controller调用这个client
     * @param id
     * @return
     * @desc 两个坑：1. @GetMapping不支持   2. @PathVariable得设置value
     */
    @RequestMapping(value = "/simple/{id}",method = RequestMethod.GET)
    public User findById(@PathVariable("id") Long id);

    @RequestMapping(value = "/user",method = RequestMethod.POST)
    public User postUser(@RequestBody User user);
}
